package com.lcxw.hxzb.friendcircle.project.system.controller;

import com.lcxw.hxzb.friendcircle.framework.web.controller.BaseController;
import com.lcxw.hxzb.friendcircle.framework.web.domain.AjaxResult;
import com.lcxw.hxzb.friendcircle.framework.web.page.TableDataInfo;
import com.lcxw.hxzb.friendcircle.project.system.domain.YwpdInfoDistrict;
import com.lcxw.hxzb.friendcircle.project.system.service.IYwpdInfoDistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 游戏信息和区服关联Controller
 * 
 * @author ruoyi
 * @date 2020-09-16
 */
@RestController
@RequestMapping("/clients/district")
public class YwpdInfoDistrictController extends BaseController
{
    @Autowired
    private IYwpdInfoDistrictService ywpdInfoDistrictService;

    /**
     * 查询游戏信息和区服关联列表
     */
    @GetMapping("/list")
    public TableDataInfo list(YwpdInfoDistrict ywpdInfoDistrict)
    {
        startPage();
        List<YwpdInfoDistrict> list = ywpdInfoDistrictService.selectYwpdInfoDistrictList(ywpdInfoDistrict);
        return getDataTable(list);
    }


    /**
     * 获取游戏信息和区服关联详细信息
     */
    @GetMapping(value = "/{districtId}")
    public AjaxResult getInfo(@PathVariable("districtId") Long districtId)
    {
        return AjaxResult.success(ywpdInfoDistrictService.selectYwpdInfoDistrictById(districtId));
    }

    /**
     * 新增游戏信息和区服关联
     */
    @PostMapping
    public AjaxResult add(@RequestBody YwpdInfoDistrict ywpdInfoDistrict)
    {
        return toAjax(ywpdInfoDistrictService.insertYwpdInfoDistrict(ywpdInfoDistrict));
    }

    /**
     * 修改游戏信息和区服关联
     */
    @PutMapping
    public AjaxResult edit(@RequestBody YwpdInfoDistrict ywpdInfoDistrict)
    {
        return toAjax(ywpdInfoDistrictService.updateYwpdInfoDistrict(ywpdInfoDistrict));
    }

    /**
     * 删除游戏信息和区服关联
     */
	@DeleteMapping("/{districtIds}")
    public AjaxResult remove(@PathVariable Long[] districtIds)
    {
        return toAjax(ywpdInfoDistrictService.deleteYwpdInfoDistrictByIds(districtIds));
    }
}
